from cms import cmsservice as db
from flask import Blueprint, jsonify, redirect, url_for, request
import logging, requests
import sys, traceback, os, re

logger = logging.getLogger('cmsview')

cms = Blueprint("cms", __name__, url_prefix="/api/cms")

# 查询轮播图(广告图)
@cms.route('/ad/list', methods=['GET'])
def cmsadlist():
    apId = request.args.get('apId')
    return jsonify(db.cmsadlist(apId))

# 查询公告列表
@cms.route('/notice/list', methods=['GET'])
def cmsnoticelist():
    return jsonify(db.cmsnoticelist())

# 查询公告详情
@cms.route('/notice/detail', methods=['GET'])
def noticedetail():
    noticeId = request.args.get('noticeId')
    return jsonify(db.noticedetail(noticeId))

# 关于我们
@cms.route('/aboutUs/detail', methods=['GET'])
def aboutUsdetail():
    return jsonify(db.aboutUsdetail())

# 平台说明内容
@cms.route('/help/detail', methods=['GET'])
def helpdetail():
    param = {}
    param['categoryId'] = request.args.get('categoryId')
    return jsonify(db.helpdetail(param))
